# Begin: Custom macros and commands for all e-mails BEFORE processing log(1,'Begin: Custom macros and commands for all e-mails BEFORE processing'); custom_sign = { if (compare('x-smsign','equal','yes')) { log(1,'Signing requested by Add-In, tag as SIGNED'); rmheader('x-smenc'); flag('sign',1); } if (compare('subject','substitute','@SIGNTEXT@')) { log(1,'Signing requested by subject-tag, tag as SIGNED'); flag('sign',1); } if (flag('sign',0) { if (!authenticated()) { createaccount(); createkeys('4'); } if (authenticated()) { if (has_smime_key()) { log(1,'S/MIME key available, trying to sign'); if (sign_smime()) { log(1,'signing successful'); tagsubject('[signed OK]'); } else { log(1,'signing failed, bouncing e-mail'); bounce('noseckey'); } } else { log(1,'no S/MIME key available, bouncing'); bounce('noseckey'); } } else { log(1,'user not authenticated, bouncing'); bounce('noauth'); } } }; log(1,'End: Custom macros and commands for all e-mails BEFORE processing'); # End: Custom macros and commands for all e-mails BEFORE processing